package com.huatech.domain;

import java.io.Serializable;

import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.security.core.userdetails.User;

import com.fasterxml.jackson.annotation.JsonIgnore;

public class UserDetail implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long openId;
	private String password;
	private String username;
	
	public long getOpenId() {
		return openId;
	}
	public void setOpenId(long openId) {
		this.openId = openId;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	@JsonIgnore
	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	public UserDetail() {
	}
	
	public UserDetail(long openId, String password, String username) {
		super();
		this.openId = openId;
		this.password = password;
		this.username = username;
	}
	public User toUser(){
		return new User(username, password, true, true, true, true, 
				AuthorityUtils.commaSeparatedStringToAuthorityList("admin"));
	}
	
	


}
